{extend name="layout/layout" /}

{block name="pagecss"}
<style>
    .layui-card .layui-form-item{
        margin-bottom: -5px;
    }
</style>
{/block}

{block name="content"}
<blockquote class="layui-elem-quote quoteBox" style="border-left:none;">
    <form class="layui-form h between">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <h2>商品调价单</h2>
            </div>
        </div>
        <div class="layui-inline">
            <a href="{:url('admin/productprice/index')}" class="layui-btn layui-bg-cyan">调价历史</a>
        </div>
    </form>
</blockquote>

<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="" lay-filter="component-form-element">
            <div class="layui-row layui-form-item">
                <div class="layui-col-lg6">
                    <label class="layui-form-label">调价单号：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$info.order_no}</div>
                    </div>
                </div>
                <div class="layui-col-lg6">
                    <label class="layui-form-label">单据状态：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$info.status}</div>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-form-item">
                <div class="layui-col-lg6">
                    <label class="layui-form-label">创建时间：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$info.create_date|substr=0,10}</div>
                    </div>
                </div>
                <div class="layui-col-lg6">
                    <label class="layui-form-label">生效时间：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$info.effective_date}</div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">调价范围：</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid layui-word-aux">{$info.range}</div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">备注说明：</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid layui-word-aux">{$info.remark}</div>
                </div>
            </div>
        </form>
    </div>
</div>

<table id="dataTable" lay-filter="dataTable"></table>

<input type="hidden" class="datalist_url" value="{:url('admin/productprice/detail', ['id' => $info.id])}">
{/block}

{block name="pagescript"}
<script type="text/javascript">
    layui.use(['form', 'layer', 'table'], function(){

        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            table = layui.table;

        var datalist_url = $('.datalist_url').val();


        // Table 列表
        var tableIns = table.render({
            elem: '#dataTable',
            url : datalist_url,
            page : true,
            cellMinWidth : 95,
            //height : "full-100",
            limit : 10,
            limits : [10, 20, 50, 100],
            id : "tableList",
            cols : [[
                {field: 'img_url', title: '封面图', minWidth:80, align:"center", templet:function(data){
                    return '<a href="'+data.img_url+'" target="_blank"><img src="'+data.img_url+'" style="width: 80px;" /></a>';
                }},
                {field: 'name', title: '商品名称'},
                {field: 'bar_code', title: '条码', align:'center'},
                {field: 'purchase_price', title: '进货价', align:'center', templet:function(data){
                    return data.purchase_price / 100;
                }},
                {field: 'price', title: '售价', align:'center', templet:function(data){
                    return data.price / 100;
                }},
                {field: 'wholesale_price', title: '批发价', align:'center', templet:function(data){
                    return data.wholesale_price / 100;
                }},
                /*{field: 'member_integral', title: '会员积分', align:'center'},*/
                {field: 'new_price', title: '新售价', align:'center', templet:function(data){
                    return data.new_price / 100;
                }},
                {field: 'wholesale_price', title: '新批发价', align:'center', templet:function(data){
                    return data.wholesale_price / 100;
                }},
                /*{field: 'new_member_integral', title: '新会员积分', align:'center'},*/
            ]],
        });
    });
</script>
{/block}